import {createRouter, createWebHashHistory} from "vue-router";

import Login from "./components/MyLogin.vue";
import CustomerLogin from "./components/loginComponents/CustomerLogin.vue";
import MerchantLogin from "./components/loginComponents/MerchantLogin.vue";


import MerchantMain from "./components/MerchantMain.vue";
import Deliveryman from "./components/merchantComponents/Deliveryman.vue";
import HistoryOrder from "./components/merchantComponents/HistoryOrder.vue";
import MerchantInfo from "./components/merchantComponents/MerchantInfo.vue";
import OpenOrder from "./components/merchantComponents/OpenOrder.vue";
import Dish from "./components/merchantComponents/Dish.vue";


import CustomerMain from "./components/CustomerMain.vue";
import CustomerInfo from "./components/customerComponents/CustomerInfo.vue";
import Address from "./components/customerComponents/Address.vue";
import Account from "./components/customerComponents/Account.vue";
import Recommend from "./components/customerComponents/Recommend.vue";
import Choice from "./components/customerComponents/Choice.vue";
import openOrder from "./components/customerComponents/OpenOrder.vue";
import historyOrder from "./components/customerComponents/HistoryOrder.vue";
import QueryDishes from "./components/customerComponents/QueryDishes.vue";
import EmployeeLogin from "./components/EmployeeLogin.vue";
import EmployeeMain from "./components/EmployeeMain.vue";


const router=createRouter({
    history: createWebHashHistory(),
    routes: [
        //访问转登录页面
        { path: '/', redirect: '/login'},
        //管理员login
        {
            path: '/qwertyuiop',
            component: EmployeeLogin
        },
        //管理员主界面
        {
            path: '/employeeMain',
            component: EmployeeMain
        },

        //login页面
        {
            path: '/login',
            component: Login,
            name:'login',
            redirect:'/login/customer',
            children: [
                { path: 'customer' ,component: CustomerLogin},
                { path: 'merchant' ,component: MerchantLogin},
            ]
        },

        //商家页面
        {
            path: '/merchantMain',
            component: MerchantMain,
            name:'merchantMain',
            redirect:'/merchantMain/merchantInfo',
            children: [
                {path: 'deliveryman', component: Deliveryman},
                {path: 'historyOrder', component: HistoryOrder},
                {path: 'merchantInfo', component: MerchantInfo},
                {path: 'openOrder', component: OpenOrder},
                {path: 'dish', component: Dish},

            ]


        },

        //顾客页面
        {
            path: '/customerMain',
            component: CustomerMain,
            name: 'customerMain',
            redirect: '/customerMain/customerInfo',
            children: [
                { path: 'customerInfo', component: CustomerInfo},
                { path: 'address', component: Address},
                { path: 'account', component: Account},
                { path: 'recommend', component: Recommend},
                { path: 'choice', component: Choice},
                { path: 'openOrder', component: openOrder},
                { path: 'historyOrder', component: historyOrder},
                { path: 'queryDishes', component: QueryDishes},

            ]


        },
        ]


})



export default router